package cn.zhpdmmz.service.impl;

import cn.zhpdmmz.entity.RoomStatus;
import cn.zhpdmmz.mapper.RoomStatusMapper;
import cn.zhpdmmz.service.IRoomStatusService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (RoomStatus)表服务实现类
 *
 * @author ZHP
 * @since 2022-05-25 15:20:19
 */
@Service("roomStatusService")
public class RoomStatusServiceImpl implements IRoomStatusService {
    @Resource
    private RoomStatusMapper roomStatusMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param statusId 主键
     * @return 实例对象
     */
    @Override
    public RoomStatus queryById(Integer statusId) {
        return this.roomStatusMapper.queryById(statusId);
    }

    /**
     * 查询指定行
     *
     * @param roomStatus 筛选条件
     * @return 查询结果
     */
    @Override
    public List<RoomStatus> queryAll(RoomStatus roomStatus) {
        return this.roomStatusMapper.queryAll(roomStatus);
    }

    /**
     * 新增数据
     *
     * @param roomStatus 实例对象
     * @return 实例对象
     */
    @Override
    public RoomStatus insert(RoomStatus roomStatus) {
        this.roomStatusMapper.insert(roomStatus);
        return roomStatus;
    }

    /**
     * 修改数据
     *
     * @param roomStatus 实例对象
     * @return 实例对象
     */
    @Override
    public RoomStatus update(RoomStatus roomStatus) {
        this.roomStatusMapper.update(roomStatus);
        return this.queryById(roomStatus.getStatusId());
    }

    /**
     * 通过主键删除数据
     *
     * @param statusId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer statusId) {
        return this.roomStatusMapper.deleteById(statusId) > 0;
    }
}
